package com.qzsf.backend.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.qzsf.backend.dto.OrganizerDetailDTO;
import com.qzsf.backend.dto.UserDetailDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/*
 * @Author: Dennis Chen
 * @CreateTime: 2024/10/30 16:07 周三
 * @Email 1429278462@qq.com
 * @Remark 用户登录信息实体类
 * @Version 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserAuth implements Serializable {
    private int id;
    private String username;
    private String password;
    private UserRole role;
    private int status;

    public UserAuth(UserDetailDTO userDetailDto){
        this.username = userDetailDto.getUsername();
        this.password = userDetailDto.getPassword();
        this.role = UserRole.USER;
        this.status = 1;
    }

    public UserAuth(OrganizerDetailDTO organizerDetailDto){
        this.username = organizerDetailDto.getUsername();
        this.password = organizerDetailDto.getPassword();
        this.role = UserRole.ORGANIZER;
        this.status = 1;
    }
}
